//
//  MineViewController.m
//  Meibang
//
//  Created by Eton on 2017/5/19.
//  Copyright © 2017年 王-庭协. All rights reserved.
//

#import "MineViewController.h"
#import "MineCell.h"
#import "SettingViewController.h"
#import "MineListModel.h"
#import "MinePresenter.h"

@interface MineViewController ()<UITableViewDelegate,UITableViewDataSource>{
    
}
@property (strong, nonatomic) MinePresenter *presenter;
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (weak, nonatomic) IBOutlet UIImageView *headImageView;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *phoneLabel;

//@property (strong, nonatomic) IBOutlet UIView *pullHeadView;

@end

@implementation MineViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    
    [self setupData];
    
    [self setupView];
}

#pragma mark - setup

- (void)setupData{
    self.presenter = [[MinePresenter alloc] init];
}

- (void)setupView{
    
}

#pragma mark - Action


#pragma mark - UITableViewDelegate,UITableViewDataSource

- (NSInteger )tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.presenter.mineArray.count;
}

- (CGFloat )tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 60;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView * headView = [[UIView alloc] init];
    return headView;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *cellIdentifier = @"MineCell";
    MineCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    MineListModel * model = self.presenter.mineArray[indexPath.row];
    cell.model = model;
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    MineListModel * model = self.presenter.mineArray[indexPath.row];
    if ([model.title isEqualToString:MineTableName_Setting]) {
        [self pushSettingViewController];
    }
}

#pragma mark - Push

//设置
- (void)pushSettingViewController{
    SettingViewController * controller = kVCFromSb(@"Mine", @"SettingViewController");
    [self.navigationController pushViewController:controller animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
